home *** CD-ROM | disk | FTP | other *** search
/ The Games Machine 76 / XENIATGM66.iso / Indiana Jones / Indiana Jones.exe / RESOURCE / PREVIEW.GOB / cog_pru_whipspike.cog < prev    next >
Text File  |  1999-11-15  |  6KB  |  261 lines

  1. # Jones 3D Cog Script
  2. #
  3. # PRU_whipspike.cog    Pick up spike, place in hole in wall, go around to other side, whip climb!
  4. #
  5. # [GGJ]
  6. # 11/16/98  Much help from Randy
  7. #
  8. # (C) 1998 LucasArts Entertainment Company LLC. All Rights Reserved
  9. #
  10. # ========================================================================================
  11. symbols
  12.  
  13. message        startup
  14. message        activated
  15. #message        arrived
  16. message        callback
  17. message        damaged
  18. message        entered
  19. message        exited
  20.  
  21. cog            talkCog        local
  22.  
  23. thing        pikespot            //ghost object where the pike is placed
  24. thing        player        local
  25. thing        placeCam            #camera that shows Indy placing the pike
  26. thing        climbCam            #camera that shows pike sliding into place
  27. thing        indy                #actor
  28. thing        target                #ghost for climbCam to target
  29. thing        placedpike    local
  30. thing        pikeObject
  31. thing        pikeGrabCam
  32. thing        grabGhost
  33.  
  34. model        pikeHand=hand_in_pike.3do     local
  35.  
  36. template    piketemplate        //the pike after it is placed
  37.  
  38. keyframe    pikeplace=in_putpike.key    local
  39. keyframe    get=in_pickup_low.key        local
  40.  
  41. sound        success=inxj112.wav                        local
  42. sound        insertSnd=pru_whipspike_insert_c.wav    local
  43. sound        climbMus=mus_gen_indywhip1.wav            local
  44. sound        foundPike=inxj233.wav                    local
  45.  
  46. surface        pikeSurf
  47.  
  48. surface        hole                //hole opening
  49.  
  50. surface        hangshort
  51. surface        opening
  52.  
  53. int            tempcam        local
  54. int            curcam        local
  55. int            placed=0    local
  56. int            handMesh    local
  57. int            swapRef        local
  58. int            once=0        local
  59. int            grabbed=0    local
  60. int            musOnce=0    local
  61. int            talking=0    local
  62. vector        v_targetpos    local
  63.  
  64. cog            voiceline
  65. cog            hint
  66.  
  67. end
  68. # ========================================================================================
  69. code
  70.  
  71. startup:
  72.  
  73.     SetCollideType(pikeObject, 0);
  74.     player = GetLocalPlayerThing();
  75.     handMesh = GetMeshByName(player, "inrhand");
  76.     
  77.     return;
  78. # .................................................................................
  79.  
  80. activated:
  81. if ((GetSenderRef() == pikeSurf) && (grabbed == 0))
  82. {
  83.     # Disable player controls and stuff
  84.     if (MakeMeStop() == -1)
  85.         return;
  86.     DeselectWeaponWait(player);
  87.  
  88.     grabbed=1;
  89.  
  90.     StartCutscene(0);
  91.     
  92.     SetExtCamOffsetToThing(pikeGrabCam);
  93.     SetExtCamLookOffsetToThing(grabGhost);
  94.  
  95.     talkCog = GetCogByIndex(0);
  96.     SendMessage(talkCog, 27);
  97.     
  98.     CaptureThing(player);
  99.     PlayKey(player, get, 5, 0x12, 0);
  100.     return;
  101. }
  102.  
  103.     if ((GetSenderRef() == hole) && (GetCurItem(player) == 72) && (placed == 0))
  104.     {
  105.         Sleep(0.25);
  106.  
  107.         # Disable player controls and stuff
  108.         if (MakeMeStop() == -1)
  109.             return;
  110.         DeselectWeaponWait(player);
  111.         
  112.         curCam = GetCurrentCamera();
  113.         StartCutscene(1);
  114.         placed = 1;
  115.         
  116.         #switch to a cutscene camera
  117.         SetCameraLookInterp(2, 0);
  118.         SetCameraPosInterp(2, 0);
  119.         SetCameraFocus(2, placeCam);
  120.         SetCameraSecondaryFocus(2, pikespot);
  121.         SetCurrentCamera(2);
  122.         ResetCameraFOV(0, 0.0);
  123.         
  124.         SetThingFlags(player, 0x80000);        #turn invisible
  125.         CopyPlayerHolsters(player, indy);
  126.         ClearThingFlags(indy, 0x80000);        #make visible
  127.         
  128.         #swap actor's hand for one with pike, & capture Indy so we'll get callback
  129.         swapRef = SetThingMesh(indy, handMesh, pikeHand, 0);
  130.         CaptureThing(indy);
  131.         
  132.         #remove whip pike from inventory
  133.         ChangeInv(player, 72, -1);
  134.         
  135.         #animate the actor (The animation will send the callback message)
  136.         MoveToFrame(placeCam, 1, 0.5);
  137.         PlayKey(indy, pikeplace, 4, 0x12, 0);
  138.         Sleep(1.0);
  139.  
  140.         PlaySoundThing(insertSnd, pikeSpot, 1.0, -1.0, -1.0, 0x0);
  141.  
  142.         return;
  143.     }
  144.     else if ((GetSenderRef() == hole) && (GetCurItem(player) != 72) && (placed == 0) && (talking == 0))
  145.     {
  146.         talking = 1;
  147.         PlayVoice(player, foundPike, 1.0, 1);
  148.         talking = 0;
  149.         return;
  150.     }
  151.            
  152.     return;
  153.  
  154. # .................................................................................
  155. #arrived:
  156. #    if (GetSenderRef() == placedpike)
  157. #    {
  158. #        DEBUGPRINT("pike thing done moving");
  159. #    }
  160.  
  161.     return;
  162.  
  163. # .................................................................................
  164. callback:
  165. if (GetSenderRef() == player)
  166. {
  167.     ReleaseThing(player);
  168.     DestroyThing(pikeObject);
  169.     ChangeInv(player, 72, 1.0);
  170.     SetInvAvailable(player, 72, 1);
  171.     JonesInvItemChanged(72);
  172.     Sleep(1.0);
  173.     PlayVoice(player, foundPike, 1.0, 0);
  174.     RestoreExtCam();
  175.     ClearActorFlags(player, 0x200000);
  176.     EndCutscene();
  177.     return;
  178. }
  179.  
  180. if (GetSenderRef() == indy)
  181. {
  182.     
  183.     if (once != 0) return;
  184.     
  185.     once=1;
  186. #    DEBUGPRINT("Entered MSG::callback");
  187.  
  188.     # switch to camera on other side of wall
  189.     SetCameraFocus(2, climbCam);
  190.     SetCameraSecondaryFocus(2, target);
  191.     SetCurrentCamera(2);
  192.     MoveToFrame(climbCam, 1, 0.5);
  193.  
  194.     ReleaseThing(indy);
  195.     RestoreThingMesh(indy, swapRef);
  196.     placedpike = CreateThing(piketemplate, pikespot);
  197.         
  198.     CaptureThing(placedpike);
  199.     
  200.     #switch back to the player while the camera isn't looking.
  201.     SetThingFlags(indy, 0x80000);
  202.     ClearThingFlags(player, 0x80000);
  203.     
  204.     MoveToFrame(placedpike, 1, 1);
  205.     
  206.     WaitForStop(placedpike);
  207.     Sleep(1.0);
  208.     
  209.     # revert cam
  210.     v_targetpos = VectorAdd(VectorTransformToOrient(player, '0.2 -0.05 0.0'), GetThingPos(player));    
  211.     SetCameraPosition(1, v_targetpos);
  212.     
  213.     SetCurrentCamera(curCam);
  214.     
  215.     #"That ought to do it..."
  216.     PlayVoice(player, success, 1, 1);
  217.     
  218.     #return player control
  219.     ClearActorFlags(player, 0x200000);
  220.     
  221.     EndCutscene();
  222.     
  223.     SendMessage(voiceline, user0);                             
  224.     SendMessage(hint, user3);
  225. }
  226.     
  227.     return;
  228.     
  229. damaged:
  230. if ((GetSenderRef() == placedPike) && (musOnce == 0))
  231. {
  232.     musOnce = 1;
  233.     Sleep(1.5);
  234.     PlaySoundLocal(climbMus, 1.0, 0.0, 0x0, 0);
  235. }
  236. return;
  237.  
  238. # .................................................................................    
  239. entered:
  240. if (GetSenderRef() == hangshort)
  241. {
  242.     ClearAdjoinFlags(opening, 0x2);
  243.     return;
  244. }
  245. return;
  246.  
  247. # .................................................................................    
  248. exited:
  249. if (GetSenderRef() == hangshort)
  250. {
  251.     Sleep(2.0);
  252.     SetAdjoinFlags(opening, 0x2);
  253.     return;
  254. }
  255. return;
  256.  
  257.  
  258. # .................................................................................    
  259. end
  260.  
  261.